package cn.itsource.pet.mapper;

import cn.itsource.basic.basicmapper.BasicMapper;
import cn.itsource.pet.pojo.domain.Pet;
import cn.itsource.pet.query.PetQuery;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
* @Entity cn.itsource.pet.domain.Pet
*/
public interface PetMapper extends BasicMapper<Pet> {


    List<Pet> pageList(PetQuery query);
    @Select("select * from t_pet where state = 1")
    List<Pet> queryPetPage();

    default void upDown(PetQuery petQuery){
        Long[] ids = petQuery.getIds();
        if (ids != null && ids.length>0){
            for (Long id : ids) {
                Pet pet = new Pet();
                pet.setId(id);
                pet.setState((long)petQuery.getState());
                this.updateByPrimaryKeySelective(pet);
            }
        }
    }

}
